package com.bandroid.demo.view;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.Button;

import com.bandroid.demo.R;
import com.bandroid.demo.base.MyActivity;
import com.base.balibrary.base.BaseActivity;
import com.base.balibrary.ioc.BaseContentView;
import com.base.balibrary.ioc.BaseOnClick;
import com.base.balibrary.ioc.BaseViewInject;
import com.base.balibrary.view.custom.dialog.FreedomLocationDialog;

/**
 * BAndroid
 * Created by YichenZ on 2015/7/24 10:34.
 */
@BaseContentView(R.layout.activity_custom_dialog)
public class CustomDialogActivity extends MyActivity{
    @BaseViewInject(R.id.topBtn)
    Button topBtn;
    @BaseViewInject(R.id.verticalBtn)
    Button verticalBtn;
    @BaseViewInject(R.id.bottomBtn)
    Button bottomBtn;

    Button vipDialogCloseBtn;
    Button vipDialogOkBtn;

    FreedomLocationDialog dialog;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initUI();
    }

    private void initUI() {
        dialog=new FreedomLocationDialog(this);
        dialog.initUI(R.layout.dialog_vip_main);
        vipDialogCloseBtn=(Button)dialog.getContentView().findViewById(R.id.vipDialogCloseBtn);
        vipDialogOkBtn=(Button)dialog.getContentView().findViewById(R.id.vipDialogOkBtn);
        vipDialogCloseBtn.setOnClickListener(this);
        vipDialogOkBtn.setOnClickListener(this);
    }

    @BaseOnClick({R.id.topBtn,R.id.verticalBtn,R.id.bottomBtn})
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.topBtn:dialog.showDialogOfTheViewBottom(topBtn);break;
            case R.id.verticalBtn:dialog.show();break;
            case R.id.bottomBtn:dialog.showDialogOfTheViewTop(verticalBtn);break;
            case R.id.vipDialogOkBtn:toastMessage(this, "ok");break;
            case R.id.vipDialogCloseBtn:dialog.dismiss();break;
        }
    }

}
